import os
import sys

def template(imag="",files="",post="",env="",script=""):
    tmp = "Bootstrap:localimage \n" + "From: %s \n"%imag +\
    "%setup\n" +"%%files\n" + files + \
    "%post\n" + post + \
    "%environment \n" + env + \
    "%runscript \n" + script
    return tmp

imags = ["/CLQCD/containers/cupy12.20_cuda11.8_ubuntu22.04.sif",
         "/CLQCD/containers/cupy10.4_cuda11.8_ubuntu22.04.sif"]

post="""
    conda uninstall cupy
    pip install cupy-cuda11x
"""

for imag in imags:
    tmp = template(imag=imag,post=post)
    print(tmp)